var FinishMainLayer02 = cc.Layer.extend({
	lead:null,
	real:null,
	versions:null,
	ctor:function () {
		this._super();
//		this.loadTitle();
		this.loadFire();
		this.loadStartButton();
		this.loadStartButtonParticle();
		return true;
	},
	loadFire: function(){
		new FireWork(this);
	},
	loadStartButton : function(){
		this.restart = new cc.MenuItemImage(
				"#finish_restart1.png",
				"#finish_restart2.png",
				this.callback,this);
		this.restart.setPosition(gg.width * 0.5, gg.height * 0.4);

//		this.versions=new cc.LabelTTF("恭 喜 过  关", "Times new Roman", 35);
//		this.versions.setFontFillColor(cc.color(0, 0, 0, 0));	
//		this.versions.setPosition(gg.width*0.5, gg.height*0.5);
		this.versions=new cc.Sprite("#title.png");
		this.versions.setPosition(gg.width*0.5, gg.height*0.55);

		this.versions1=new cc.LabelTTF("V1.1", "Times new Roman", 16);
		this.versions1.setFontFillColor(cc.color(0, 0, 0, 0));	
		this.versions1.setPosition(gg.width*0.95, gg.height*0.034);

		var menu = new cc.Menu();
		this.addChild(menu);
		menu.setPosition(0, 0);
		menu.addChild(this.restart);
		this.addChild(this.versions,1);
		this.addChild(this.versions1,1)
	},
	loadStartButtonParticle : function(){
		var restart_node = new cc.ParticleSystem(res_start02.follow_p);
		this.addChild(restart_node);
		restart_node.setPosition(this.restart.x - this.restart.width / 2, this.restart.y - this.restart.height / 2);
		var action = this.getFollowAction(10, this.restart);
		restart_node.runAction(action);
	},
	getFollowAction : function(stretch, node){
		var width = node.width;
		var height = node.height;

		var bezier1 = [cc.p(-stretch, 0), cc.p(-stretch, height), cc.p(0, height)];
		var bezierBy1 = cc.bezierBy(0.6, bezier1);
		var move1 = new cc.moveBy(0.7, cc.p(width, 0));

		var bezier2 = [cc.p(stretch, 0), cc.p(stretch, -height), cc.p(0, -height)];
		var bezierBy2 = cc.bezierBy(0.6, bezier2);
		var move2 = new cc.moveBy(0.7, cc.p(-width, 0));

		var action = cc.sequence(bezierBy1, move1, bezierBy2, move2).repeatForever();
		return action;
	},
	callback:function(pSend){
		switch(pSend){
		case this.restart:
			cc.log("重新开始");
			$.runScene(new StartScene02());
			break;
		}
	}
});
